from pathlib import Path
import os
from rcfg import RCfg
from rui import RUi
from rctl import RCtl

g_cfg = '~/.release.cfg'


def init_cfg() -> RCfg:
    p = Path(os.path.expanduser(g_cfg))
    if not p.is_file():
        try:
            p.touch()
        except PermissionError:
            print('Create cache directory failed, may be you should use '
                  'super-user privilege')
    return RCfg(os.path.expanduser(g_cfg))

if __name__ == '__main__':
    # releaser = ''
    # while releaser == '' or releaser.isspace():
    #     releaser = input_dialog(
    #         title='Config release', text='Please type releaser name:').run()
    ...
    ui = RUi()
    cfg = init_cfg()
    cfg.load()
    ctl = RCtl(cfg)
    ctl.pop_man()